#include <iostream>  
#include <bits/stdc++.h>  
using namespace std;  
map<string,long long>a; 
int main()
{
	int n,m,s,i;
	char id[20];
	long long dis;
	scanf("%d %d",&n,&s);
	for(i=0;i<n;i++)
	{
		scanf("%s %lld",&id,&dis);
		if(dis<s) dis=s;
		if(a.find(id)!=a.end()) a[id]+=dis;
		else a[id]=dis;
	}
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%s",&id);
		if(a.find(id)!=a.end())
		     printf("%lld\n",a[id]);
		else printf("No Info\n");
	}
	return 0;
}
